<link  href="/stylesheets/tests.css" type="text/css" rel="stylesheet" media="screen">
<title>添加量表分类</title>
<p  class="smallNav">专业量表管理>>修改量表分类</p>
<style type="text/css" rel="stylesheet">
    form {
    margin: 0;
    }
    .editor {
    margin-top: 5px;
    margin-bottom: 5px;
    }
    .ke-content {
    font-family: Courier New;
    font-size: 12px;
    background-color: #ffffff;
}

  </style>
    <script type="text/javascript" charset="utf-8" src="/kindeditor/kindeditor.js"></script>
  <script type="text/javascript">
    KE.show({
        id : 'type_escription',
        resizeMode :1,
        cssPath : '/kindeditor/examples/index.css',
        items : [
        'fontname', 'fontsize', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline',
        ]
    });
  </script>
<div style="margin: 25px 0 10px 0">
<% form_for(:type, :url => { :action => "createnew_type" }, :html=>{:class=>"required-validate" ,:id=>"type_form"}) do |f| %>
  <%= tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, 
                 :value => form_authenticity_token) %> 
    <b>分类名称:</b><%= f.text_field :name %><br/>
    <b>分类说明:</b><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <%= f.text_area :description, :style=>"width:300px;height:160px;visibility;" %><br/>
    <input type="button" name=""  style="margin-left:50px;"value="添加" onclick="add_type();">
  <% end %>
    <br />
<table class="datalist">
  <tr>
    <th scope="col" width="40">序号</th> 
    <th scope="col" width="180">名称</th>
    <th scope="col" width="200">说明</th>
    <th colspan="5" scope="col"></th>
  </tr>
  <%  i = 0  
    @types.each do |type| 
  %>
    <% if i%2 == 0 %>
  <tr>
    <% else %>
  <tr  class="altrow">    
    <% end %>
    <td><%=h type.id %></td>    
    <td><%=h type.name %></td>
    <td><%=h truncate(type.description, :length => 80) %></td>
    <td>
     <%=link_to '编辑' ,:action=>"edit_type" ,:id=>type.id%>
    </td>
    <td>
     <a onclick="return confirm('确定删除?');" href="/surveys/prof_surveys/destroy_type/<%=type.id%>">删除</a>
    </td>
  </tr>
  <% 
    i += 1
    end 
  %>
</table>
</div>

<script>
function add_type(){
    var form1=document.getElementById("type_form");
    form1.submit();
}
</script>
